*********************************************************************************************
*Replication code: Main Text*****************************************************************
*********************************************************************************************
clear
set scheme aspen

set more off

log using AshMorelliVannoni_PSRM2020

use "AshMorelliVannoni_PSRM2020.dta", clear

xtset state year, yearly delta(1)



*// Table 1 

reghdfe civil_service_reform_ipe divided_either , a( state  )    cl(state ) 
outreg2 using Table1, tex replace keep(divided_either) label   ctitle(Merit IPE)    addtext(State FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_either , a(state year   )    cl(state ) 
outreg2 using Table1, tex append keep(divided_either)  label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe true_divided_gov_a, a(state year)   cl(state) 
outreg2 using Table1, tex append keep(true_divided_gov_a) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_either ideociti urban income  lfullemp , a(state year)   cl(state ) 
outreg2 using Table1, tex append keep(divided_either ideociti urban income  lfullemp ) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_either ideociti urban income  lfullemp, a(state##c.year year)   cl(state ) 
outreg2 using Table1, tex append keep(divided_either ideociti urban income  lfullemp) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X,  State-Specific Trends, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

ologit civil_service_reform_ipe divided_either ideociti urban income  lfullemp i.year  i.state ,   cl(state) 
outreg2 using Table1, tex append keep(divided_either ideociti urban income  lfullemp) label   ctitle(Merit IPE - Ologit)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform divided_either ideociti urban income  lfullemp, a(state year )     cl(state ) 
outreg2 using Table1, tex append keep(divided_either ideociti urban income  lfullemp ) label   ctitle(Merit)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

*// Table 2

reghdfe civil_service_reform_ipe divided_governor divided_chamber , a(state  )   cl(state ) 
outreg2 using Table2, tex replace keep(divided_governor divided_chamber ) label   ctitle(Merit IPE)    addtext(State FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_governor divided_chamber , a(state year )   cl(state ) 
outreg2 using Table2, tex append keep(divided_governor divided_chamber)  label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp, a(state year )   cl(state ) 
outreg2 using Table2, tex append keep(divided_governor divided_chamber ideociti urban income  lfullemp) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp , a(state##c.year year )   cl(state ) 
outreg2 using Table2, tex append keep(divided_governor divided_chamber ideociti urban income  lfullemp ) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X,  State-Specific Trends, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

ologit civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp i.year  i.state ,   cl(state) 
outreg2 using Table2, tex append keep(divided_governor divided_chamber ideociti urban income  lfullemp ) label   ctitle(Merit IPE - Ologit)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

reghdfe civil_service_reform divided_governor divided_chamber ideociti urban income  lfullemp, a(state year )     cl(state ) 
outreg2 using Table2, tex append keep(divided_governor divided_chamber ideociti urban income  lfullemp ) label   ctitle(Merit)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

*effect on second category stronger for divided chambers

quietly ologit civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp i.year  i.state ,   cl(state)
margins, predict(outcome(2)) at( divided_governor =0) atmeans post

quietly ologit civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp i.year  i.state ,   cl(state)
margins, predict(outcome(2)) at( divided_governor =1) atmeans post

quietly ologit civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp i.year  i.state ,   cl(state)
margins, predict(outcome(2)) at( divided_chamber =0) atmeans post

quietly ologit civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp i.year  i.state ,   cl(state)
margins, predict(outcome(2)) at( divided_chamber =1) atmeans post

*// Figure 1

grstyle init
grstyle set plain, horizontal grid

eststo clear
eststo: reghdfe civil_service_reform_ipe divided_either , a(state year  state##c.year )    cl(state ) 
eststo: reghdfe civil_service_reform_ipe true_divided_gov_a, a(state year state##c.year)   cl(state) 
eststo: reghdfe civil_service_reform_ipe divided_governor divided_chamber , a(state year state##c.year)   cl(state ) 


coefplot est1 est2 est3, drop(_cons) xline(0, lpattern(dash) lcolor(gray)) ci(90) xtitle("Effect on Probability of Civil Service Reform") nokey mlabsize(medium) ylabel(.) mlabels(divided_either = 2 "Divided Any" true_divided_gov_a=2 "Divided Government Veto" divided_governor = 2 "Divided Governor" divided_chamber = 2 "Divided Chamber")

graph export main-coefplot.pdf, replace


* results hold when dropping southern states

reghdfe civil_service_reform_ipe  divided_either if !southern  , a(state year )    cl(state ) 
*********************************************************************************************
*Replication code: Appendix******************************************************************
*********************************************************************************************
*\Table a1

outreg2 using table1a, tex replace sum(log) label keep(civil_service_reform civil_service_reform_ipe ipe simple_divided_gov true_divided_gov_a divided_governor true_divided_gov_e divided_either divided_chamber sen_gov_share hs_gov_share dem_gov_share divided_either  ideociti  urban income  lfullemp)


*\Table a2-a4

foreach x in simple_divided_gov true_divided_gov_a true_divided_gov_e   {

areg civil_service_reform_ipe `x', a(state)   cl(state) 
outreg2 using Table_a`x', tex replace keep(`x') label   ctitle(Merit IPE)    addtext(State FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
areg civil_service_reform_ipe `x' i.year, a(state)   cl(state) 
outreg2 using Table_a`x', tex append keep(`x') label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
areg civil_service_reform_ipe `x' ideociti urban income  lfullemp i.year i.state#c.year, a(state)   cl(state) 
outreg2 using Table_a`x', tex append keep(`x' ideociti urban income  lfullemp) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, State-Specific Trends, X, Controls, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
ologit civil_service_reform_ipe `x' ideociti urban income  lfullemp i.year  i.state,   cl(state) 
outreg2 using Table_a`x', tex append keep(`x' ideociti urban income  lfullemp) label   ctitle(Merit IPE - Ologit)    addtext(State FE, X, Time FE, X, Controls, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
areg civil_service_reform `x' ideociti urban income  lfullemp i.year i.state#c.year, a(state)   cl(state)
outreg2 using Table_a`x', tex append keep(`x' ideociti urban income  lfullemp) label   ctitle(Merit)    addtext(State FE, X, Time FE, X,State-Specific Trends, X,  Controls, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
}


*\Table a5


* table 1 column 2
reghdfe civil_service_reform_ipe sen_gov_share hs_gov_share dem_gov_share divided_either , a(state year )    cl(state ) 
outreg2 using Table_a5, tex replace keep(divided_either)  label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, Shares, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
* table 1 column 3
reghdfe civil_service_reform_ipe true_divided_gov_a sen_gov_share hs_gov_share dem_gov_share  , a(state year)   cl(state) 
outreg2 using Table_a5, tex append keep(true_divided_gov_a) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, Shares, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
* table 1 column 5
reghdfe civil_service_reform_ipe divided_either ideociti urban income  lfullemp sen_gov_share hs_gov_share dem_gov_share, a(state##c.year year)   cl(state ) 
outreg2 using Table_a5, tex append keep(divided_either ideociti urban income  lfullemp) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, Shares, X,  State-Specific Trends, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
* table 2 column 2
reghdfe civil_service_reform_ipe divided_governor divided_chamber sen_gov_share hs_gov_share dem_gov_share , a(state year )   cl(state ) 
outreg2 using Table_a5, tex append keep(divided_governor divided_chamber)  label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, Shares, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)
* table 2 column 4
reghdfe civil_service_reform_ipe divided_governor divided_chamber ideociti urban income  lfullemp sen_gov_share hs_gov_share dem_gov_share , a(state##c.year year )   cl(state ) 
outreg2 using Table_a5, tex append keep(divided_governor divided_chamber ideociti urban income  lfullemp ) label   ctitle(Merit IPE)    addtext(State FE, X, Time FE, X, Shares, X,  State-Specific Trends, X) alpha(0.01, 0.05, 0.1) symbol(**, *, +)  nonotes addnote(SE clustered by `e(clustvar)', **p<.01; *p<.05; +p<.1)

